<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .content {
      margin: 150px auto;
      width: 900px;
    }

  </style>
</head>
<body>
  <div id="app" class="content">
    <my-component></my-component>
    <my-component2></my-component2>
    <child message="hello!"></child>

    <div class="">
      <input type="text" name="" value="" v-model="parentMsg">
      <br>
      <!-- <child v-bind:message="parentMsg"></child> -->
      <child :message="parentMsg"></child>
    </div>
  </div>
  <div id="app2" class="content">
    <p>{{ totalCount }}</p>
    <button-counter v-on:increment="incrementTotal"></button-counter>
    <button-counter v-on:increment="incrementTotal"></button-counter>
  </div>
  <script src="../js/lib/vue.js"></script>
  <script src="../js/lib/art-template.js"></script>
  <script src="../js/lib/jquery-2.1.1.js"></script>
  <script>
    Vue.component('my-component', {
      template: '<div>A custom component</div>'
    });

    var component2 = {
      template: '<div>other custom component</div>'
    }

    Vue.component('child', {
      props: ['message'],
      template: '<span>{{ message }}</span>'
    });
    Vue.component('child', {
      props: ['message'],
      template: '<span>{{ message }}</span>'
    });

    var app = new Vue({
      el: "#app",
      data: {
        parentMsg: ''
      },
      components: {
        'my-component2': component2
      }
    });

    Vue.component('button-counter', {
      template: '<button @click="increment">{{ count }}</button>',
      data: function() {
        return {
          count: 0
        };
      },
      methods: {
        increment: function() {
          this.count += 1;
          this.$emit('increment');
        }
      }
    });
    var app2 = new Vue({
      el: "#app2",
      data: {
        totalCount: 0
      },
      methods: {
        incrementTotal: function() {
          this.totalCount += 1;
        }
      }
    });
  </script>
</body>
</html>
